![]() |
PATH![]() |
![]() ![]() |
AppleScript provides Unit Type value classes for working with measurements of length, area, cubic and liquid volume, mass, and temperature. Unit Type classes are simple values that do not contain other values and have only a single property, the Class property. You can use the Unit Type classes in any script and they do not need to be enclosed in a Tell block.
AppleScript provides coercions from Unit Type to String and Number (Real or Integer) and from String, Real, or Integer to Unit Type. You can also coerce between Unit Types in the same category, such as inches to kilometers (length) or gallons to liters (liquid volume). As you would expect, there is no coercion between categories, such as from gallons to degrees Centigrade.
Note that AppleScript did not implement the quarts and degrees Kelvin Unit Types or support coercions from miles to other types until version 1.3.7.
The following sections list the available Unit Types and show how to work with them in scripts:
For an overview of value coercion in AppleScript, see Coercing Values.